import "@/plugins/z-dragxml/components/ZDragLoop/index.scss"
import {createZDragLoopDef, createZDragLoopTemplate} from "@/plugins/z-dragxml/components/ZDragLoop";
// import {nextTick} from "vue";

let def = createZDragLoopDef(
  {

    entiels: [
      // ['对象', 'obj'],
      ['数组对象', 'arrayObj'],
      ['GRID', 'grid'],
      ['GRID-ITEM', 'gridItem'],
    ],
    resolveData(data) {
      data.INIT_CONFIG= {
        ui: {
          defType: 'gridItem'
        }
      }
      // console.log('ZDragTab', data)
      return data
    },
    // disabledDrag: true
  },
)
def.inject = ['ZDragxmlInstance', 'ZDragLoopSTabIns']
def.name = "ZDragTabItem"
def.template = createZDragLoopTemplate({
  cls: 'z-drag-loop--grid-item',
})
def.DRAG_PANEL_CLS =  'panel__z-drag-loop panel__z-drag-grids panel__z-drag-gridlayout-item'
def.DRAG_GROUP =  'high'
def.NOT_IN_GROUP = true
def.methods.onCreated = function () {
  // console.log('onCreated',  this.ZDragLoopSTabIns)
  // let self = this
  // if (!this.widgets || this.widgets.length < 1) {
  //   let ctx = {
  //     handleObj(obj) {
  //       // console.log('ctx', obj)
  //       obj.afterAttr = ` defType="gridItem" `
  //       return obj
  //     }
  //   }
  //   this.private_append_widget('ZDragLoop', ctx)
  //   this.private_append_widget('ZDragLoop', ctx)
  //   nextTick(() => {
  //     setTimeout(() => {
  //       self.ZDragxmlInstance.reloadTreeMenu()
  //     }, 50)
  //   })
  // }
}
def.DRAG_LABEL_XML = function () {
  return `<div class="z-dragxml-row">
<svg t="1647505837311" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2216" width="16" height="16"><path d="M932.571429 54.857143H91.428571c-20.228571 0-36.571429 16.342857-36.571428 36.571428v841.142858c0 20.228571 16.342857 36.571429 36.571428 36.571428h841.142858c20.228571 0 36.571429-16.342857 36.571428-36.571428V91.428571c0-20.228571-16.342857-36.571429-36.571428-36.571428z m-795.428572 82.285714h155.428572v749.714286H137.142857V137.142857z m749.714286 749.714286H365.714286V365.714286h521.142857v521.142857zM365.714286 292.571429V137.142857h521.142857v155.428572H365.714286z" p-id="2217"></path></svg>
<div class="z-dragxml-label__name">布局item</div>
</div>`
}
export default def
